<include file="App/Home/View/Public/header.html"/>
<!-----------------------------主体内容 开始------------------------------>
  <div data-role="main" class="ui-content">
  <!------一键分享时间 开始------->
    <div class="logo1">
      <div class="logo1_w70p textalign_c">
        <p class="textcolor_yellow1 sizeem15">
          <span>{$Think.lang.__WODEZONGFENXIANGSHIJIAN__}</span><br>
          <span>{$sum_time}</span><br>
          <span>{$Think.lang.__BENCIFENXIANGSHIJIAN__}</span><br>
          <span id="time">{$time}</span><br>
          <button class="color_yellow1 border_none" <eq name="add_time" value="0"> <else />disabled="disabled"</eq> <eq name="switch" value="close">disabled="disabled"</eq> onclick="share();">一键分享</button>
        </p>
      </div>  
    </div>
    <div class="clear"></div>
  <!------一键分享时间 结束------->
  <!------一键分享介绍 开始------->
  <p>
    <div class="logo1">
      <div class="pad0_5">
        <p class="textcolor_yellow1">
          <span>{$Think.lang.__YIJIANFENXIANGNEIRONGN1__}：</span>
        </p>
        <p class="textcolor_yellow1">
          <span>{$Think.lang.__YIJIANFENXIANGNEIRONGN2__}</span>
        </p>
        <p class="textcolor_yellow1">
          <span>{$Think.lang.__YIJIANFENXIANGNEIRONGN3__}</span>
        </p>
        <p class="textcolor_yellow1">
          <span>{$Think.lang.__YIJIANFENXIANGNEIRONGN4__}</span>
        </p>
        <p class="textcolor_yellow1">
          <span>{$Think.lang.__YIJIANFENXIANGNEIRONGN5__}</span>
        </p>
      </div>  
    </div>
    <div class="clear"></div>
  </p>
  <!------一键分享介绍 结束------>
  </div>
  <input type="hidden" id="add_time" value="{$add_time}">
<!-----------------------------主体内容 结束------------------------------>
<script type="text/javascript">
	function share(){
		var share_key = "{$add_time}";
		if(share_key != 0){
			layer.msg("{$Think.lang.__YIJINGZAIFENXIANGLE__}");
			return false;
		}
		$.ajax({
			url:"{:U('Share/share_add')}",
			type:"POST",
			data:null,
			dataType:"JSON",
			success:function (data){
				if(data.status == 1){
					share_time();
					location.replace(location);
				}else{
					layer.msg(data.info);
				}
			},
			error:function (){
				layer.msg('{$Think.lang.__WANGLUOYICHANGQINGCHONGSHI__}');
			}
		})
	}
	
	//var "nowtimes{$Think.session.USER_KEY_ID}" = <?php echo time();?>;
	
	var nowtimes{$Think.session.RAND_USER}= <?php echo time();?>;
	var sh_time = "{$add_time}";
	function PrefixInteger(num, length) {
	
		 return ( "00" + num ).substr( -length );  
		}  
	
	function share_time(){
		var share_key = "{$Think.session.SHARE_KEY}";
		if(sh_time == 0){
			return false;
		}
		
		
	    parseInt(sh_time);
		
		if(sh_time == 0){
			sh_time = nowtimes{$Think.session.RAND_USER};
		}
		var timestamp = nowtimes{$Think.session.RAND_USER};
		var time = timestamp - sh_time;
		nowtimes{$Think.session.RAND_USER} += 1;
		
		time = Math.floor(time)
		var year = time/(365*24*60*60);
		var month = (time%(365*24*60*60))/(30*24*60*60);
		var day = (time%(30*24*60*60))/(24*60*60);
		var h = (time%(24*60*60))/(60*60);
		var m = (time%(60*60))/60;
		var s = time%60;
		year = Math.floor(year);month = Math.floor(month);day = Math.floor(day);h = Math.floor(h);m = Math.floor(m);s = Math.floor(s);
		
		h = PrefixInteger(h,2);
		m = PrefixInteger(m,2);
		s = PrefixInteger(s,2);
		var end_time = year+"-"+month+"-"+day+" "+h+":"+m+":"+s;
		$('#time').html(end_time);
	}
	
	setInterval("share_time()",1000);
	
	
</script>
<!-----------------------------底部 开始------------------------------>
<include file="App/Home/View/Public/footer.html"/>